<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
   <title>Migration of Qmaster</title>
</head>
<body>

<h2>
<font color="#336699">Migration of Qmaster to Another Machine</font></h2>
<b><font size=+1>Overview</font></b>
<p>1. Check that the new master host has read/write access
<br>2. Run the migrate script on the new master host
<br>3. Manually migrate the qmaster host
<br>4. Modify the <font face="Courier New, Courier, monospace">shadow_masters</font>
file if necessary
<br>&nbsp;
<p><b><font size=+1>1) Check that the new master host has read/write access</font></b><b><font size=+1></font></b>
<p>The new master host must have read/write access to the qmaster <font face="Courier New,Courier">spool</font>
directory and <font face="Courier New,Courier">common</font> directory
as does the current master. If the administrative user is user&nbsp;<span 
 style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">root</span></font>
(check&nbsp; the global cluster configuration for the setting of&nbsp;<span 
 style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">admin_user</span></font>),
you should check if user&nbsp;<span 
 style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">root</span></font>
can create files in these directory under his user name.
<br>&nbsp;
<p><b><font size=+1>2) Run the migrate script on the new master host<sup>1,2,3</sup></font></b>
<p>On the new master host, run the following script as user&nbsp;<span 
 style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">root</span></font>:
<pre style="margin-bottom: 0.2in; margin-left: 40px;"><font face="Courier New,Courier"># /etc/init.d/rcsge -migrate</font></pre>
This will stop <font face="Courier New, Courier, monospace">sge_qmaster</font>
and <font face="Courier New, Courier, monospace">sge_schedd</font> on the
old master host and start them up on the new master host. The master host
name listed in the file:
<pre style="margin-bottom: 0.2in; margin-left: 40px;"><font face="Courier New,Courier">$SGE_ROOT/$SGE_CELL/common/act_qmaster</font></pre>
is automatically changed to the new master host. If qmaster is not running
warning messages will be printed and there will be a delay of approx. 60
seconds until qmaster is started on the new host.
<br>&nbsp;
<p><span style="font-weight: bold;"><b><font size=+1>3) Manually migrate
the qmaster host</font></b></span>
<p>It is also possible to change the qmaster host manually. Stop the master
and scheduler daemon on the current master by running the following command:
<pre style="margin-bottom: 0.2in; margin-left: 40px;"><font face="Courier New,Courier"># qconf -ks -km</font></pre>

<pre>Then edit&nbsp;<span style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">$SGE_ROOT/$SGE_CELL/common/act_qmaster</font></span></pre>

<p><br>In the&nbsp;<span style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">act_qmaster</span></font>
file, the current hostname will need to be replaced with the new master
host's name. This name should be the same as the name returned by the utility&nbsp;<span style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">gethostname</span></font>.
Run the following command on the new master host:
<pre style="margin-bottom: 0.2in; margin-left: 40px;"><font face="Courier New,Courier"># $SGE_ROOT/utilbin/&lt;arch>/gethostname</font></pre>
Put this name in the&nbsp;<span 
 style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">act_qmaster</span></font>
file in place of the old name.
<p>Run&nbsp;<span style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">rcsge</span></font>
on the new master host
<pre style="margin-bottom: 0.2in; margin-left: 40px;"><font face="Courier New,Courier"># $SGE_ROOT/default/common/rcsge -qmaster</font></pre>
This will start up&nbsp;<span 
 style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">sge_qmaster</span></font>
and&nbsp;<span style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">sge_schedd</span></font>
on the new master host.
<br>&nbsp;
<p><b><font size=+1>4) Modify the <font face="Courier New, Courier, monospace">shadow_masters</font>
file if necessary<sup>4</sup></font></b>
<p>Check if the following file exists:
<pre style="margin-bottom: 0.2in; margin-left: 40px;"><font face="Courier New,Courier">$SGE_ROOT/$CELL/common/shadow_masters</font></pre>
If it does exist you can add the new qmaster host to this file and remove
the old master host, depending on your requirements. Then stop and restart
the <font face="Courier New, Courier, monospace">sge_shadowd</font> daemons
by issuing the following commands on the respective machines:
<pre style="margin-bottom: 0.2in; margin-left: 40px;"><font face="Courier New,Courier">/etc/init.d/rcsge -shadowd stop
/etc/init.d/rcsge -shadowd start</font></pre>

<div style="text-align: left;">
(The location of the system wide&nbsp;<span 
 style="font-family: courier new,courier,monospace;"><font face="Courier New,Courier">rcsge</span></font> startup script may differ on your operating
system.)

<pre>You can always use<span 
 style="font-family: courier new,courier,monospace;"> <font face="Courier New,Courier">$SGE_ROOT/default/common/rcsge</span></font>)</pre>
</div>

<p><b><font size=+1>Notes</font></b>
<p>1. The migration procedure migrates to the host on which the " <font face="Courier New, Courier, monospace">rcsge
-migrate</font>" command is issued. If the file <font face="Courier New, Courier,
monospace">primary_qmaster</font>
exists, any subsequent calls of <font face="Courier New, Courier, monospace">rcsge</font>
on the machine contained in the <font face="Courier New, Courier,
monospace">primary_qmaster
</font>file will cause a migration back to that machine. To avoid such
a situation, this file needs to be changed or deleted:
<pre style="margin-bottom: 0.2in; margin-left: 40px;"><font face="Courier New,Courier">$SGE_ROOT/$SGE_CELL/common/primary_qmaster</font></pre>
Existence of the <font face="Courier New, Courier, monospace">primary_qmaster</font>
file does not imply that the qmaster is actually running.
<p>2. Jobs may continue to run during the migration procedure, however
it is prudent that the grid should be inactive. While the migration is
taking place, any SGE commands, such as <font face="Courier New, Courier, monospace">qsub</font>
or <font face="Courier New, Courier, monospace">qstat</font> will return
an error.
<p>3. If the current qmaster is down, there will be a delay in shutting
down the scheduler until it times out waiting for contact with the qmaster.
<p>4. The <font face="Courier New, Courier, monospace">shadow_masters</font>
file has no direct effect on the migration procedure. This file will only
exist if one or more shadow masters have been configured. For more information
on how to set up shadow masters, see the Howto <a href="shadow.html">Setting
Up A Shadow Master In Grid Engine.</a>
<br>&nbsp;
</body>
</html>
